home *** CD-ROM | disk | FTP | other *** search
Wrap
package { import com.plus9.mockups.InputManager; import com.plus9.mockups.dialogs.BaseDialog; import flash.accessibility.*; import flash.data.*; import flash.debugger.*; import flash.desktop.*; import flash.display.*; import flash.errors.*; import flash.events.*; import flash.external.*; import flash.filesystem.*; import flash.filters.*; import flash.geom.*; import flash.html.*; import flash.html.script.*; import flash.media.*; import flash.net.*; import flash.printing.*; import flash.profiler.*; import flash.system.*; import flash.text.*; import flash.ui.*; import flash.utils.*; import flash.xml.*; import mx.binding.*; import mx.containers.Canvas; import mx.containers.ControlBar; import mx.controls.Button; import mx.controls.Text; import mx.core.UIComponentDescriptor; import mx.core.mx_internal; import mx.events.PropertyChangeEvent; import mx.styles.*; public class ExportPNGConfirmationDialog extends BaseDialog { public static const KIND_SINGLE:Boolean = false; public static const KIND_MULTIPLE:Boolean = true; public static const SELECTION_APPEND:uint = 0; public static const SELECTION_REPLACE:uint = 1; public static const SELECTION_REPLACE_ALL:uint = 2; protected var _existingFileName:String; public var selection:uint; private var _890562171_createNew:Button; public var fullPathToUse:String; private var _842245771_replace:Button; protected var _kind:Boolean = false; private var _981817656_message:Text; private var _documentDescriptor_:UIComponentDescriptor; private var _144754708_replaceAll:Button; protected var _newFile:File; public function ExportPNGConfirmationDialog() { _documentDescriptor_ = new UIComponentDescriptor({ "type":BaseDialog, "propertiesFactory":function():Object { return { "width":524, "height":202, "childDescriptors":[new UIComponentDescriptor({ "type":Canvas, "stylesFactory":function():void { this.right = "10"; this.bottom = "10"; this.left = "10"; this.top = "10"; }, "propertiesFactory":function():Object { return {"childDescriptors":[new UIComponentDescriptor({ "type":Text, "id":"_message", "propertiesFactory":function():Object { return {"percentWidth":100}; } })]}; } }),new UIComponentDescriptor({ "type":ControlBar, "stylesFactory":function():void { this.horizontalAlign = "right"; }, "propertiesFactory":function():Object { return {"childDescriptors":[new UIComponentDescriptor({ "type":Button, "id":"_replaceAll", "events":{"click":"___replaceAll_click"}, "propertiesFactory":function():Object { return {"label":"Replace All Files"}; } }),new UIComponentDescriptor({ "type":Button, "id":"_replace", "events":{"click":"___replace_click"}, "propertiesFactory":function():Object { return {"label":"Replace the Existing File"}; } }),new UIComponentDescriptor({ "type":Button, "id":"_createNew", "events":{"click":"___createNew_click"}, "propertiesFactory":function():Object { return {"label":"Create a new File"}; } })]}; } })] }; } }); super(); mx_internal::_document = this; this.width = 524; this.height = 202; } public function set _replace(param1:Button) : void { var _loc2_:Object = this._842245771_replace; if(_loc2_ !== param1) { this._842245771_replace = param1; this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_replace",_loc2_,param1)); } } [Bindable(event="propertyChange")] public function get _createNew() : Button { return this._890562171_createNew; } [Bindable(event="propertyChange")] public function get _message() : Text { return this._981817656_message; } public function set _createNew(param1:Button) : void { var _loc2_:Object = this._890562171_createNew; if(_loc2_ !== param1) { this._890562171_createNew = param1; this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_createNew",_loc2_,param1)); } } protected function onClick(param1:Event) : void { switch(param1.target) { case _replaceAll: fullPathToUse = _newFile.nativePath.substr(0,_newFile.nativePath.lastIndexOf("/") + 1) + _existingFileName + ".png"; selection = SELECTION_REPLACE_ALL; break; case _replace: fullPathToUse = _newFile.nativePath.substr(0,_newFile.nativePath.lastIndexOf("/") + 1) + _existingFileName + ".png"; selection = SELECTION_REPLACE; break; case _createNew: fullPathToUse = _newFile.nativePath; selection = SELECTION_APPEND; } dispatchEvent(new Event("exportClick")); } override public function initialize() : void { mx_internal::setDocumentDescriptor(_documentDescriptor_); super.initialize(); } public function get kind() : Boolean { return _kind; } public function ___replaceAll_click(param1:MouseEvent) : void { onClick(param1); } public function ___replace_click(param1:MouseEvent) : void { onClick(param1); } public function set _replaceAll(param1:Button) : void { var _loc2_:Object = this._144754708_replaceAll; if(_loc2_ !== param1) { this._144754708_replaceAll = param1; this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_replaceAll",_loc2_,param1)); } } public function initExportPNGConfirmationDialog(param1:InputManager, param2:String, param3:File) : void { super.init(param1); if(param2.indexOf("/") != -1) { param2 = param2.substr(param2.lastIndexOf("/") + 1); } _existingFileName = param2; _newFile = param3; _message.text = "A file called " + _existingFileName + ".png already exists.\n\nWould you like to replace it or create a new file called " + _newFile.name + "?"; defaultButton = _createNew; _createNew.setFocus(); } public function ___createNew_click(param1:MouseEvent) : void { onClick(param1); } public function set kind(param1:Boolean) : void { _kind = param1; title = _kind == KIND_MULTIPLE ? "Export All Snapshots as PNG" : "Export Snapshot to PNG"; _replaceAll.includeInLayout = _replaceAll.visible = _kind == KIND_MULTIPLE; } public function set _message(param1:Text) : void { var _loc2_:Object = this._981817656_message; if(_loc2_ !== param1) { this._981817656_message = param1; this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_message",_loc2_,param1)); } } [Bindable(event="propertyChange")] public function get _replace() : Button { return this._842245771_replace; } override public function closeYourself() : void { _createNew.removeEventListener(MouseEvent.CLICK,onClick); super.closeYourself(); } [Bindable(event="propertyChange")] public function get _replaceAll() : Button { return this._144754708_replaceAll; } } }